package com.zyit.web;

import com.zyit.DataObject.T_user;
import com.zyit.dao.UserDao;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet("/UpdataPassword")
public class UpdataPassword extends HttpServlet {
    private UserDao userDao = new UserDao();
    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        String account = req.getParameter("account");
        String email = req.getParameter("email");
        String password = req.getParameter("password");
        System.out.println(account);
        System.out.println(email);
        System.out.println(password);
        Integer integer = userDao.UpdataPassword(account, email, password);

        if (integer!=-1){
          resp.getWriter().write("{\"status\": 1,  \"account\": \"" + account + "\", \"email\": \"" + email + "\"}");
        }
    }
}
